/*
 *  TestingUtil.java
 * 
 *  Created on May 5, 2008, 1:04:01 PM
 */
package pl.edu.agh.ssm.monitor;

import pl.edu.agh.ssm.monitor.data.SessionDescription;
import pl.edu.agh.ssm.monitor.parsers.sdp.InvalidDataException;
import pl.edu.agh.ssm.monitor.parsers.sdp.SDPParser;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author aneezka
 */
public class TestingUtil {

    public static SessionDescription getTestSessionDescription() {
        try {
            String sdpData = getSDPTestString();
            SDPParser instance = new SDPParser();
            SessionDescription result = instance.parse(sdpData);
            return result;
        } catch (InvalidDataException ex) {
            Logger.getLogger(TestingUtil.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
    public static String getSDPTestString() {
            String sdpData = "";
            StringBuilder builder = new StringBuilder();
            builder.append("v=2\n");
            builder.append("s=test data\n");
            builder.append("o=aneezka\n");
            builder.append("i=testing data\n");
            builder.append("u=www.aaa.com\n");
            builder.append("e=aaa@aaa\n");
            builder.append("b=CT:128\n");
            builder.append("b=AS:124\n");
            Date date = new Date();
            long start = (date.getTime() / 1000L);
            long end = start + 172800;
            builder.append("t=" + start + " " + end + "\n");
            builder.append("r=24h 1h 0 10m\n");
            builder.append("t=" + (start + 120) + " " + (end + 120) + "\n");
            builder.append("a=blabla:d\n");
            builder.append("a=iiiiiii::))\n");
            builder.append("m=media1\n");
            builder.append("i=testing media1\n");
            builder.append("c=connection info\n");
            builder.append("m=media2\n");
            builder.append("i=testing media2\n");
            builder.append("b=bandwidth info\n");
            builder.append("b=CT:128\n");
            builder.append("a=rtpmap:99 h263-1998/90000\n");
            builder.append("a=mimimi\n");
            sdpData = builder.toString();
            
            return sdpData;
    }
        
}
